package O4.arr;

import java.util.Arrays;

public class ArraySort {
    public static void main(String[] args) {
        int[] ns = { 28, 12, 89, 73, 65, 18, 96, 50, 8, 36 };

        for (int i=0;i<ns.length-1;i++){
            for (int j=0;j<ns.length-i-1;j++){
                if(ns[j]>ns[j+1]){
                    int tmp = ns[j];
                    ns[j] = ns[j+1];
                    ns[j+1] = tmp;
                }
            }
        }

        System.out.println(Arrays.toString(ns));
        int[] ns2 = { 28, 12, 89, 73, 65, 18, 96, 50, 8, 36 };
        for (int i=0;i<ns.length-1;i++){
            for (int j=i+1; j<ns.length ;j++){
                if (ns2[i] < ns2[j]) {
                    int tmp = ns2[j];
                    ns2[j] = ns2[i];
                    ns2[i] = tmp;
                }
            }
        }

        System.out.println(Arrays.toString(ns2));

    }
}
